import Vue from 'vue';
import VueResource from 'vue-resource';
import VueRouter from 'vue-router';
import App from './App';
import home from './components/home/home';
import dome from './components/search/dome';
import none from './components/travel/none';
import index from './components/airticket/index';

import jingdian from './components/jingdian/jingdian';
import jiudian from './components/jiudian/jiudian';
import lunbo from './components/lunbo/lunbo';


import "./assets/js/flexible.js";
import './assets/css/swiper.min.css';
import "./assets/css/tongyong.css";
import "./assets/css/reset.css";



import VueAwesomeSwiper from 'vue-awesome-swiper';
import Vuex from 'vuex';
import VueLazyload from 'vue-lazyload'
import mylvmama from './components/mylvmama/mylvmama';
import menpiao from './components/menpiao/menpiao';
import menu from './components/menu/menu';
import guanggao from './components/guanggao/guanggao';
import zhangjiajie from './components/zhangjiajie/zhangjiajie';
import login from './components/login/login';
import Car from './components/car/car.vue';

Vue.use(VueAwesomeSwiper);
Vue.use(VueResource);
Vue.use(VueRouter);
Vue.use(Vuex);

// Vue.use(VueLazyload)

Vue.use(VueLazyload, {
  preLoad: 1.3,
  loading:'./static/imgs/loading.png',
  attempt: 1
})



let store=new Vuex.Store({
  state:{
    hide:false,
    show:false,
    article:{}
  },
  mutations:{
    changeState(state){
      state.hide=!state.hide;
    },
    changeShow(state){
      state.show=!state.show;
    },
    goods(state,obj){   
      Vue.set(state.article,obj.id,obj);
      console.log(state.article)
    },
    remove(state,i){
      delete state.article[i];
    }
}
})    

let router= new VueRouter({
    routes:[
        {
            path:"/",
            redirect:"/home"
        },
        {
            path:'/home',
            component:home
        },
        {
            path:'/mylvmama',
            component:mylvmama
        },
        {
            path:'/lunbo',
            component:lunbo
        },
        {
            path:'/jiudian',
            component:jiudian
        },
        {
            path:'/jingdian',
            component:jingdian
        },
        {
            path:'/menpiao',
            component:menpiao
        },
        {
            path:'/airticket',
             component:index
         },
        {
            path:'/search',
            component:dome
        },
        {
            path:'/travel',
            component:none
        },
        {
            path:'/menu',
            component:menu
        },
        {
            path:'/guanggao',
            component:guanggao
        },
        {
            path:'/zhangjiajie/:para',
            component:zhangjiajie
        },
        {
            path:"/login",
            component:login
        },
        {
            path:"/car",
            component:Car
        }
    ]
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  // components: { App },
  // template: '<app/>',
  // render:function(h){
  //   return h(App)
  // }
  // h=>h(App)
  render:h=>h(App),
  store:store,
  router
})

